summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-10 15:35:06 -0300
committerAndrés <andmarti@gmail.com>2021-06-10 15:35:06 -0300
commitf228076b745bc15cc65179d1df29f60888985483 (patch)
treee3ca1d02b045bf8868225fc569563c5a4e4bc7e6 /src
parent6136687ae9db8f1a12afff2e45e4385ae3bd21aa (diff)
scroll correctly in edit mode when editing cells with long strings
Diffstat (limited to 'src')
-rw-r--r--src/tui.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tui.c b/src/tui.c
index 1824dec..8a3f690 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -540,7 +540,9 @@ void ui_print_mult_pend() {
// Return cursor to previous position
wmove(input_pad, row_orig, col_orig);
- ui_refresh_pad(0);
+ int scroll = 0;
+ if (inputline_pos > COLS - 14) scroll = inputline_pos - COLS + 14;
+ ui_refresh_pad(scroll);
if (status_line_empty && curmode != EDIT_MODE && get_conf_int("show_cursor")) {
// Leave cursor on selected cell when no status message
@@ -1012,7 +1014,9 @@ void ui_show_content(WINDOW * win, int nb_mobile_rows, int nb_mobile_cols) {
// auto wrap
int newheight = (wcslen(out) + sh->fwidth[col] - 1) / sh->fwidth[col];
if (sh->row_format[row] < newheight) sh->row_format[row] = newheight;
+ }
+ if (!conf_overlap || sh->row_format[row] != 1) {
int k;
wchar_t *p_out = out;
for (k = 0; k < sh->row_format[row]; k++) {
@@ -1161,7 +1165,7 @@ void ui_show_celldetails() {
ui_set_ucolor(input_win, &ucolors[CELL_FORMAT], DEFAULT_COLOR);
#endif
- register struct ent *p1 = *ATBL(sh, sh->tbl, sh->currow, sh->curcol);
+ struct ent *p1 = *ATBL(sh, sh->tbl, sh->currow, sh->curcol);
// show padding
if (p1 != NULL && p1->pad)
@@ -1195,10 +1199,10 @@ void ui_show_celldetails() {
// cut string if its too large!
if (strlen(head) > COLS - il_pos - 1) {
- head[COLS - il_pos - 1 - 15]='>';
- head[COLS - il_pos - 1 - 14]='>';
- head[COLS - il_pos - 1 - 13]='>';
- head[COLS - il_pos - 1 - 12]='\0';
+ head[COLS - il_pos - 1 - 19]='>';
+ head[COLS - il_pos - 1 - 18]='>';
+ head[COLS - il_pos - 1 - 17]='>';
+ head[COLS - il_pos - 1 - 16]='\0';
}
mvwprintw(input_win, 0, il_pos, "%s", head);