mirror of
https://github.com/tstack/lnav.git
synced 2024-09-19 08:48:02 +03:00
[listview] fix a couple of glitches with the selection
This commit is contained in:
parent
68b48fcc6a
commit
37eb9cfa36
@ -52,7 +52,7 @@ db_label_source::text_value_for_line(textview_curses& tc,
|
||||
*/
|
||||
|
||||
label_out.clear();
|
||||
if (row >= (int) this->dls_rows.size()) {
|
||||
if (row < 0_vl || row >= (int) this->dls_rows.size()) {
|
||||
return;
|
||||
}
|
||||
for (int lpc = 0; lpc < (int) this->dls_rows[row].size(); lpc++) {
|
||||
@ -85,7 +85,7 @@ db_label_source::text_attrs_for_line(textview_curses& tc,
|
||||
struct line_range lr(0, 0);
|
||||
const struct line_range lr2(0, -1);
|
||||
|
||||
if (row >= (int) this->dls_rows.size()) {
|
||||
if (row < 0_vl || row >= (int) this->dls_rows.size()) {
|
||||
return;
|
||||
}
|
||||
auto alt_row_index = row % 4;
|
||||
|
@ -380,6 +380,7 @@ handle_paging_key(int ch)
|
||||
|
||||
case 'J':
|
||||
if (tc->is_selectable()) {
|
||||
if (tc->get_selection() >= 0_vl) {
|
||||
tc->toggle_user_mark(&textview_curses::BM_USER,
|
||||
tc->get_selection());
|
||||
lnav_data.ld_select_start[tc] = tc->get_selection();
|
||||
@ -387,6 +388,7 @@ handle_paging_key(int ch)
|
||||
if (tc->get_selection() + 1_vl < tc->get_inner_height()) {
|
||||
tc->set_selection(tc->get_selection() + 1_vl);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (lnav_data.ld_last_user_mark.find(tc)
|
||||
== lnav_data.ld_last_user_mark.end()
|
||||
|
@ -114,8 +114,11 @@ listview_curses::reload_data()
|
||||
} else if (this->lv_selection >= this->get_inner_height()) {
|
||||
this->set_selection(this->get_inner_height() - 1_vl);
|
||||
} else {
|
||||
auto curr_sel = this->lv_selection;
|
||||
auto curr_sel = this->get_selection();
|
||||
|
||||
if (curr_sel == -1_vl) {
|
||||
curr_sel = 0_vl;
|
||||
}
|
||||
this->lv_selection = -1_vl;
|
||||
this->set_selection(curr_sel);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ public:
|
||||
|
||||
vis_line_t get_selection() const
|
||||
{
|
||||
if (this->lv_selectable) {
|
||||
if (this->lv_selectable && this->lv_selection != -1_vl) {
|
||||
return this->lv_selection;
|
||||
}
|
||||
return this->lv_top;
|
||||
|
Loading…
Reference in New Issue
Block a user