summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-08-09 14:10:12 +0200
committerBoris Faure <billiob@gmail.com>2015-08-09 14:10:12 +0200
commit7af60a58c809ef605d9c11643874d2a1dcf70ac2 (patch)
tree765fe5ddb2a65b614f87f2aa21a7f86c90c81fde
parentb4c91eee470e7b25a1e262be78c87400f7597c2a (diff)
BACKLOG_ROW_GET() should not be called with a "screen" value
the backlog is independent of the screen size. Thus a single line in the backlog can span many lines on the screen.
-rw-r--r--src/bin/miniview.c3
-rw-r--r--src/bin/termio.c14
-rw-r--r--src/bin/termpty.c28
-rw-r--r--src/bin/termpty.h2
4 files changed, 18 insertions, 29 deletions
diff --git a/src/bin/miniview.c b/src/bin/miniview.c
index f06f5cd..7ff65ee 100644
--- a/src/bin/miniview.c
+++ b/src/bin/miniview.c
@@ -502,7 +502,8 @@ _deferred_renderer(void *data)
502{ 502{
503 Miniview *mv = data; 503 Miniview *mv = data;
504 Evas_Coord ox, oy, ow, oh; 504 Evas_Coord ox, oy, ow, oh;
505 int history_len, wret, pos; 505 int history_len, pos;
506 ssize_t wret;
506 unsigned int *pixels, y; 507 unsigned int *pixels, y;
507 Termcell *cells; 508 Termcell *cells;
508 Termpty *ty; 509 Termpty *ty;
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 82b7972..31ddca4 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -2037,7 +2037,8 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y,
2037 for (y = c1y; y <= c2y; y++) 2037 for (y = c1y; y <= c2y; y++)
2038 { 2038 {
2039 Termcell *cells; 2039 Termcell *cells;
2040 int w, last0, v, start_x, end_x; 2040 ssize_t w;
2041 int last0, v, start_x, end_x;
2041 2042
2042 w = 0; 2043 w = 0;
2043 last0 = -1; 2044 last0 = -1;
@@ -2427,7 +2428,8 @@ termio_paste_selection(Evas_Object *obj, Elm_Sel_Type type)
2427static void 2428static void
2428_sel_line(Termio *sd, int cy) 2429_sel_line(Termio *sd, int cy)
2429{ 2430{
2430 int y, w = 0; 2431 int y;
2432 ssize_t w = 0;
2431 Termcell *cells; 2433 Termcell *cells;
2432 2434
2433 termpty_backlog_lock(); 2435 termpty_backlog_lock();
@@ -2772,7 +2774,8 @@ static void
2772_sel_word(Termio *sd, int cx, int cy) 2774_sel_word(Termio *sd, int cx, int cy)
2773{ 2775{
2774 Termcell *cells; 2776 Termcell *cells;
2775 int x, y, w = 0; 2777 int x, y;
2778 ssize_t w = 0;
2776 Eina_Bool done = EINA_FALSE; 2779 Eina_Bool done = EINA_FALSE;
2777 2780
2778 termpty_backlog_lock(); 2781 termpty_backlog_lock();
@@ -3183,7 +3186,7 @@ _selection_dbl_fix(Termio *sd
3183{ 3186{
3184#if defined(SUPPORT_DBLWIDTH) 3187#if defined(SUPPORT_DBLWIDTH)
3185 int start_x, start_y, end_x, end_y; 3188 int start_x, start_y, end_x, end_y;
3186 int w = 0; 3189 ssize_t w = 0;
3187 Termcell *cells; 3190 Termcell *cells;
3188 /* Only change the end position */ 3191 /* Only change the end position */
3189 3192
@@ -4489,7 +4492,8 @@ _smart_apply(Evas_Object *obj)
4489 Evas_Coord ox, oy, ow, oh; 4492 Evas_Coord ox, oy, ow, oh;
4490 Eina_List *l, *ln; 4493 Eina_List *l, *ln;
4491 Termblock *blk; 4494 Termblock *blk;
4492 int x, y, w, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0; 4495 int x, y, ch1 = 0, ch2 = 0, inv = 0, preedit_x = 0, preedit_y = 0;
4496 ssize_t w;
4493 4497
4494 EINA_SAFETY_ON_NULL_RETURN(sd); 4498 EINA_SAFETY_ON_NULL_RETURN(sd);
4495 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); 4499 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 1ed4cff..4422e82 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -711,28 +711,12 @@ add_new_ts:
711ssize_t 711ssize_t
712termpty_row_length(Termpty *ty, int y) 712termpty_row_length(Termpty *ty, int y)
713{ 713{
714 Termsave *ts; 714 ssize_t wret;
715 Termcell *cells = termpty_cellrow_get(ty, y, &wret);
715 716
716 if (y >= 0) 717 if (y >= 0)
717 { 718 return termpty_line_length(cells, ty->w);
718 Termcell *cells; 719 return cells ? wret : 0;
719 if (y >= ty->h)
720 {
721 ERR("invalid row given: %d while ty->h=%d", y, ty->h);
722 return 0;
723 }
724 cells = &(TERMPTY_SCREEN(ty, 0, y));
725 return termpty_line_length(cells, ty->w);
726 }
727 if ((y < -(int)ty->backsize) || !ty->back)
728 {
729 ERR("invalid row given: %d; ty->back:%p ty->backsize:%zd",
730 y, ty->back, ty->backsize);
731 return 0;
732 }
733 ts = BACKLOG_ROW_GET(ty, y);
734
735 return ts->cells ? ts->w : 0;
736} 720}
737 721
738ssize_t 722ssize_t
@@ -800,7 +784,7 @@ termpty_backscroll_adjust(Termpty *ty, int *scroll)
800} 784}
801 785
802static Termcell* 786static Termcell*
803_termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, int *wret) 787_termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, ssize_t *wret)
804{ 788{
805 int backlog_y = ty->backlog_beacon.backlog_y; 789 int backlog_y = ty->backlog_beacon.backlog_y;
806 int screen_y = ty->backlog_beacon.screen_y; 790 int screen_y = ty->backlog_beacon.screen_y;
@@ -845,7 +829,7 @@ _termpty_cellrow_from_beacon_get(Termpty *ty, int requested_y, int *wret)
845} 829}
846 830
847Termcell * 831Termcell *
848termpty_cellrow_get(Termpty *ty, int y_requested, int *wret) 832termpty_cellrow_get(Termpty *ty, int y_requested, ssize_t *wret)
849{ 833{
850 if (y_requested >= 0) 834 if (y_requested >= 0)
851 { 835 {
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 4abecad..b76d740 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -236,7 +236,7 @@ void termpty_free(Termpty *ty);
236void termpty_backlog_lock(void); 236void termpty_backlog_lock(void);
237void termpty_backlog_unlock(void); 237void termpty_backlog_unlock(void);
238 238
239Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret); 239Termcell *termpty_cellrow_get(Termpty *ty, int y, ssize_t *wret);
240ssize_t termpty_row_length(Termpty *ty, int y); 240ssize_t termpty_row_length(Termpty *ty, int y);
241void termpty_write(Termpty *ty, const char *input, int len); 241void termpty_write(Termpty *ty, const char *input, int len);
242void termpty_resize(Termpty *ty, int new_w, int new_h); 242void termpty_resize(Termpty *ty, int new_w, int new_h);