]> git.armaanb.net Git - asd-repo.git/blob - extra/vis/patches/soft-wrap.patch
9d9c04bd754943f50052388da708baf9a3ea8b49
[asd-repo.git] / extra / vis / patches / soft-wrap.patch
1 From cc3a7e5566f7a33deeed5cbdcb9057e585c91dde Mon Sep 17 00:00:00 2001
2 From: Andrey Proskurin <>
3 Date: Sun, 9 May 2021 00:34:16 +0000
4 Subject: [PATCH 1/5] view: refactor view_addch
5
6 ---
7  view.c | 158 ++++++++++++++++++++++++++++-----------------------------
8  1 file changed, 79 insertions(+), 79 deletions(-)
9
10 diff --git a/view.c b/view.c
11 index 74967dc6..b10deb92 100644
12 --- a/view.c
13 +++ b/view.c
14 @@ -164,98 +164,98 @@ Filerange view_viewport_get(View *view) {
15         return (Filerange){ .start = view->start, .end = view->end };
16  }
17  
18 +static bool view_add_cell(View *view, const Cell *cell) {
19 +       size_t lineno = view->line->lineno;
20 +       
21 +       if (view->col + cell->width > view->width) {
22 +               for (int i = view->col; i < view->width; i++)
23 +                       view->line->cells[i] = view->cell_blank;
24 +               view->line = view->line->next;
25 +               view->col = 0;
26 +       }
27 +
28 +       if (!view->line)
29 +               return false;
30 +       
31 +       view->line->width += cell->width;
32 +       view->line->len += cell->len;
33 +       view->line->lineno = lineno;
34 +       view->line->cells[view->col] = *cell;
35 +       view->col++;
36 +       /* set cells of a character which uses multiple columns */
37 +       for (int i = 1; i < cell->width; i++)
38 +               view->line->cells[view->col++] = cell_unused;
39 +       return true;
40 +}
41 +
42 +static bool view_expand_tab(View *view, Cell *cell) {
43 +       cell->width = 1;
44 +       
45 +       int displayed_width = view->tabwidth - (view->col % view->tabwidth);
46 +       for (int w = 0; w < displayed_width; ++w) {
47 +       
48 +               int t = (w == 0) ? SYNTAX_SYMBOL_TAB : SYNTAX_SYMBOL_TAB_FILL;
49 +               const char *symbol = view->symbols[t]->symbol;
50 +               strncpy(cell->data, symbol, sizeof(cell->data) - 1);
51 +               cell->len = (w == 0) ? 1 : 0;
52 +               
53 +               if (!view_add_cell(view, cell))
54 +                       return false;
55 +       }
56 +       
57 +       cell->len = 1;
58 +       return true;
59 +}
60 +
61 +static bool view_expand_newline(View *view, Cell *cell) {
62 +       const char *symbol = view->symbols[SYNTAX_SYMBOL_EOL]->symbol;
63 +       strncpy(cell->data, symbol, sizeof(cell->data) - 1);
64 +       cell->width = 1;
65 +       
66 +       if (!view_add_cell(view, cell))
67 +               return false;
68 +
69 +       for (int i = view->col; i < view->width; ++i)
70 +               view->line->cells[i] = view->cell_blank;
71 +
72 +       size_t lineno = view->line->lineno;
73 +       view->line = view->line->next;
74 +       view->col = 0;
75 +       if (view->line)
76 +               view->line->lineno = lineno + 1;
77 +       
78 +       return true;
79 +}
80 +
81  /* try to add another character to the view, return whether there was space left */
82  static bool view_addch(View *view, Cell *cell) {
83         if (!view->line)
84                 return false;
85  
86 -       int width;
87 -       size_t lineno = view->line->lineno;
88         unsigned char ch = (unsigned char)cell->data[0];
89         cell->style = view->cell_blank.style;
90  
91         switch (ch) {
92         case '\t':
93 -               cell->width = 1;
94 -               width = view->tabwidth - (view->col % view->tabwidth);
95 -               for (int w = 0; w < width; w++) {
96 -                       if (view->col + 1 > view->width) {
97 -                               view->line = view->line->next;
98 -                               view->col = 0;
99 -                               if (!view->line)
100 -                                       return false;
101 -                               view->line->lineno = lineno;
102 -                       }
103 -
104 -                       cell->len = w == 0 ? 1 : 0;
105 -                       int t = w == 0 ? SYNTAX_SYMBOL_TAB : SYNTAX_SYMBOL_TAB_FILL;
106 -                       strncpy(cell->data, view->symbols[t]->symbol, sizeof(cell->data)-1);
107 -                       view->line->cells[view->col] = *cell;
108 -                       view->line->len += cell->len;
109 -                       view->line->width += cell->width;
110 -                       view->col++;
111 -               }
112 -               cell->len = 1;
113 -               return true;
114 +               return view_expand_tab(view, cell);
115         case '\n':
116 -               cell->width = 1;
117 -               if (view->col + cell->width > view->width) {
118 -                       view->line = view->line->next;
119 -                       view->col = 0;
120 -                       if (!view->line)
121 -                               return false;
122 -                       view->line->lineno = lineno;
123 -               }
124 -
125 -               strncpy(cell->data, view->symbols[SYNTAX_SYMBOL_EOL]->symbol, sizeof(cell->data)-1);
126 -
127 -               view->line->cells[view->col] = *cell;
128 -               view->line->len += cell->len;
129 -               view->line->width += cell->width;
130 -               for (int i = view->col + 1; i < view->width; i++)
131 -                       view->line->cells[i] = view->cell_blank;
132 -
133 -               view->line = view->line->next;
134 -               if (view->line)
135 -                       view->line->lineno = lineno + 1;
136 -               view->col = 0;
137 -               return true;
138 -       default:
139 -               if (ch < 128 && !isprint(ch)) {
140 -                       /* non-printable ascii char, represent it as ^(char + 64) */
141 -                       *cell = (Cell) {
142 -                               .data = { '^', ch == 127 ? '?' : ch + 64, '\0' },
143 -                               .len = 1,
144 -                               .width = 2,
145 -                               .style = cell->style,
146 -                       };
147 -               }
148 -
149 -               if (ch == ' ') {
150 -                       strncpy(cell->data, view->symbols[SYNTAX_SYMBOL_SPACE]->symbol, sizeof(cell->data)-1);
151 -
152 -               }
153 -
154 -               if (view->col + cell->width > view->width) {
155 -                       for (int i = view->col; i < view->width; i++)
156 -                               view->line->cells[i] = view->cell_blank;
157 -                       view->line = view->line->next;
158 -                       view->col = 0;
159 -               }
160 +               return view_expand_newline(view, cell);
161 +       case ' ':
162 +               const char *symbol = view->symbols[SYNTAX_SYMBOL_SPACE]->symbol;
163 +               strncpy(cell->data, symbol, sizeof(cell->data) - 1);
164 +               return view_add_cell(view, cell);
165 +       }
166  
167 -               if (view->line) {
168 -                       view->line->width += cell->width;
169 -                       view->line->len += cell->len;
170 -                       view->line->lineno = lineno;
171 -                       view->line->cells[view->col] = *cell;
172 -                       view->col++;
173 -                       /* set cells of a character which uses multiple columns */
174 -                       for (int i = 1; i < cell->width; i++)
175 -                               view->line->cells[view->col++] = cell_unused;
176 -                       return true;
177 -               }
178 -               return false;
179 +       if (ch < 128 && !isprint(ch)) {
180 +               /* non-printable ascii char, represent it as ^(char + 64) */
181 +               *cell = (Cell) {
182 +                       .data = { '^', ch == 127 ? '?' : ch + 64, '\0' },
183 +                       .len = 1,
184 +                       .width = 2,
185 +                       .style = cell->style,
186 +               };
187         }
188 +       return view_add_cell(view, cell);
189  }
190  
191  static void cursor_to(Selection *s, size_t pos) {
192
193 From 50e75ddf8a73feab300d7789d000f9687a509f18 Mon Sep 17 00:00:00 2001
194 From: Andrey Proskurin <>
195 Date: Sun, 9 May 2021 18:17:20 +0000
196 Subject: [PATCH 2/5] view.c: add word wrapping
197
198 ---
199  view.c | 61 +++++++++++++++++++++++++++++++++++++++++++---------------
200  1 file changed, 45 insertions(+), 16 deletions(-)
201
202 diff --git a/view.c b/view.c
203 index b10deb92..e7ca8141 100644
204 --- a/view.c
205 +++ b/view.c
206 @@ -80,6 +80,10 @@ struct View {
207         bool need_update;   /* whether view has been redrawn */
208         bool large_file;    /* optimize for displaying large files */
209         int colorcolumn;
210 +       // TODO lua option: breakat / brk
211 +       const char *breakat; /* characters which might cause a word wrap */
212 +       int wrapcol;         /* used while drawing view content, column where word wrap might happen */
213 +       bool prevch_breakat; /* used while drawing view content, previous char is part of breakat */
214  };
215  
216  static const SyntaxSymbol symbols_none[] = {
217 @@ -109,6 +113,7 @@ static bool view_viewport_up(View *view, int n);
218  static bool view_viewport_down(View *view, int n);
219  
220  static void view_clear(View *view);
221 +static bool view_add_cell(View *view, const Cell *cell);
222  static bool view_addch(View *view, Cell *cell);
223  static void selection_free(Selection*);
224  /* set/move current cursor position to a given (line, column) pair */
225 @@ -156,6 +161,8 @@ static void view_clear(View *view) {
226         view->bottomline->next = NULL;
227         view->line = view->topline;
228         view->col = 0;
229 +       view->wrapcol = 0;
230 +       view->prevch_breakat = false;
231         if (view->ui)
232                 view->cell_blank.style = view->ui->style_get(view->ui, UI_STYLE_DEFAULT);
233  }
234 @@ -164,19 +171,37 @@ Filerange view_viewport_get(View *view) {
235         return (Filerange){ .start = view->start, .end = view->end };
236  }
237  
238 +static void view_wrap_line(View *view) {
239 +       Line *cur_line = view->line;
240 +       int cur_col = view->col;
241 +       int wrapcol = (view->wrapcol > 0) ? view->wrapcol : cur_col;
242 +       
243 +       view->line = cur_line->next;
244 +       view->col = 0;
245 +       view->wrapcol = 0;
246 +       if (view->line) {
247 +               /* move extra cells to the next line */
248 +               for (int i = wrapcol; i < cur_col; ++i) {
249 +                       const Cell *cell = &cur_line->cells[i];
250 +                       view_add_cell(view, cell);
251 +                       cur_line->width -= cell->width;
252 +                       cur_line->len -= cell->len;
253 +               }
254 +       }
255 +       for (int i = wrapcol; i < view->width; ++i) {
256 +               /* clear remaining of line */
257 +               cur_line->cells[i] = view->cell_blank;
258 +       }
259 +}
260 +
261  static bool view_add_cell(View *view, const Cell *cell) {
262         size_t lineno = view->line->lineno;
263         
264 -       if (view->col + cell->width > view->width) {
265 -               for (int i = view->col; i < view->width; i++)
266 -                       view->line->cells[i] = view->cell_blank;
267 -               view->line = view->line->next;
268 -               view->col = 0;
269 -       }
270 +       if (view->col + cell->width > view->width)
271 +               view_wrap_line(view);
272  
273         if (!view->line)
274                 return false;
275 -       
276         view->line->width += cell->width;
277         view->line->len += cell->len;
278         view->line->lineno = lineno;
279 @@ -208,22 +233,18 @@ static bool view_expand_tab(View *view, Cell *cell) {
280  }
281  
282  static bool view_expand_newline(View *view, Cell *cell) {
283 +       size_t lineno = view->line->lineno;
284         const char *symbol = view->symbols[SYNTAX_SYMBOL_EOL]->symbol;
285 +       
286         strncpy(cell->data, symbol, sizeof(cell->data) - 1);
287         cell->width = 1;
288 -       
289         if (!view_add_cell(view, cell))
290                 return false;
291  
292 -       for (int i = view->col; i < view->width; ++i)
293 -               view->line->cells[i] = view->cell_blank;
294 -
295 -       size_t lineno = view->line->lineno;
296 -       view->line = view->line->next;
297 -       view->col = 0;
298 +       view->wrapcol = 0;
299 +       view_wrap_line(view);
300         if (view->line)
301                 view->line->lineno = lineno + 1;
302 -       
303         return true;
304  }
305  
306 @@ -233,8 +254,14 @@ static bool view_addch(View *view, Cell *cell) {
307                 return false;
308  
309         unsigned char ch = (unsigned char)cell->data[0];
310 +       bool ch_breakat = strchr(view->breakat, ch);
311 +       if (view->prevch_breakat && !ch_breakat) {
312 +               /* this is a good place to wrap line if needed */
313 +               view->wrapcol = view->col;
314 +       }
315 +       view->prevch_breakat = ch_breakat;
316         cell->style = view->cell_blank.style;
317 -
318 +       
319         switch (ch) {
320         case '\t':
321                 return view_expand_tab(view, cell);
322 @@ -519,6 +546,8 @@ View *view_new(Text *text) {
323                 .data = " ",
324         };
325         view->tabwidth = 8;
326 +       // TODO default value
327 +       view->breakat = "";
328         view_options_set(view, 0);
329  
330         if (!view_resize(view, 1, 1)) {
331
332 From b50672e3233e5e2d2a537d697082806a5012d6ac Mon Sep 17 00:00:00 2001
333 From: Andrey Proskurin <>
334 Date: Sun, 9 May 2021 21:56:36 +0000
335 Subject: [PATCH 3/5] add `wrapcolumn / wc` and `breakat / brk` options
336
337 ---
338  man/vis.1  |  5 +++++
339  sam.c      | 12 ++++++++++++
340  view.c     | 29 +++++++++++++++++++++++------
341  view.h     |  2 ++
342  vis-cmds.c |  6 ++++++
343  5 files changed, 48 insertions(+), 6 deletions(-)
344
345 diff --git a/man/vis.1 b/man/vis.1
346 index 05433663..2f6b4754 100644
347 --- a/man/vis.1
348 +++ b/man/vis.1
349 @@ -1423,6 +1423,11 @@ WARNING: modifying a memory mapped file in-place will cause data loss.
350  Whether to use vertical or horizontal layout.
351  .It Cm ignorecase , Cm ic Op Cm off
352  Whether to ignore case when searching.
353 +.It Ic wrapcolumn , Ic wc Op Ar 0
354 +Wrap lines at minimum of window width and wrapcolumn.
355 +.
356 +.It Ic breakat , brk Op Dq Pa ""
357 +Characters which might cause a word wrap.
358  .El
359  .
360  .Sh COMMAND and SEARCH PROMPT
361 diff --git a/sam.c b/sam.c
362 index 29e9c583..d7540e07 100644
363 --- a/sam.c
364 +++ b/sam.c
365 @@ -301,6 +301,8 @@ enum {
366         OPTION_CHANGE_256COLORS,
367         OPTION_LAYOUT,
368         OPTION_IGNORECASE,
369 +       OPTION_BREAKAT,
370 +       OPTION_WRAP_COLUMN,
371  };
372  
373  static const OptionDef options[] = {
374 @@ -394,6 +396,16 @@ static const OptionDef options[] = {
375                 VIS_OPTION_TYPE_BOOL,
376                 VIS_HELP("Ignore case when searching")
377         },
378 +       [OPTION_BREAKAT] = {
379 +               { "breakat", "brk" },
380 +               VIS_OPTION_TYPE_STRING|VIS_OPTION_NEED_WINDOW,
381 +               VIS_HELP("Characters which might cause a word wrap")
382 +       },
383 +       [OPTION_WRAP_COLUMN] = {
384 +               { "wrapcolumn", "wc" },
385 +               VIS_OPTION_TYPE_NUMBER|VIS_OPTION_NEED_WINDOW,
386 +               VIS_HELP("Wrap lines at minimum of window width and wrapcolumn")
387 +       },
388  };
389  
390  bool sam_init(Vis *vis) {
391 diff --git a/view.c b/view.c
392 index e7ca8141..79fc7bc1 100644
393 --- a/view.c
394 +++ b/view.c
395 @@ -80,9 +80,9 @@ struct View {
396         bool need_update;   /* whether view has been redrawn */
397         bool large_file;    /* optimize for displaying large files */
398         int colorcolumn;
399 -       // TODO lua option: breakat / brk
400 -       const char *breakat; /* characters which might cause a word wrap */
401 -       int wrapcol;         /* used while drawing view content, column where word wrap might happen */
402 +       char *breakat;  /* characters which might cause a word wrap */
403 +       int wrapcolumn; /* wrap lines at minimum of window width and wrapcolumn (if != 0) */
404 +       int wrapcol;    /* used while drawing view content, column where word wrap might happen */
405         bool prevch_breakat; /* used while drawing view content, previous char is part of breakat */
406  };
407  
408 @@ -171,6 +171,12 @@ Filerange view_viewport_get(View *view) {
409         return (Filerange){ .start = view->start, .end = view->end };
410  }
411  
412 +static int view_max_text_width(const View *view) {
413 +       if (view->wrapcolumn > 0)
414 +               return MIN(view->wrapcolumn, view->width);
415 +       return view->width;
416 +}
417 +
418  static void view_wrap_line(View *view) {
419         Line *cur_line = view->line;
420         int cur_col = view->col;
421 @@ -197,7 +203,7 @@ static void view_wrap_line(View *view) {
422  static bool view_add_cell(View *view, const Cell *cell) {
423         size_t lineno = view->line->lineno;
424         
425 -       if (view->col + cell->width > view->width)
426 +       if (view->col + cell->width > view_max_text_width(view))
427                 view_wrap_line(view);
428  
429         if (!view->line)
430 @@ -519,6 +525,7 @@ void view_free(View *view) {
431                 selection_free(view->selections);
432         free(view->textbuf);
433         free(view->lines);
434 +       free(view->breakat);
435         free(view);
436  }
437  
438 @@ -546,8 +553,8 @@ View *view_new(Text *text) {
439                 .data = " ",
440         };
441         view->tabwidth = 8;
442 -       // TODO default value
443 -       view->breakat = "";
444 +       view->breakat = strdup("");
445 +       view->wrapcolumn = 0;
446         view_options_set(view, 0);
447  
448         if (!view_resize(view, 1, 1)) {
449 @@ -891,6 +898,16 @@ int view_colorcolumn_get(View *view) {
450         return view->colorcolumn;
451  }
452  
453 +void view_wrapcolumn_set(View *view, int col) {
454 +       if (col >= 0)
455 +               view->wrapcolumn = col;
456 +}
457 +
458 +void view_breakat_set(View *view, const char *breakat) {
459 +       free(view->breakat);
460 +       view->breakat = strdup(breakat);
461 +}
462 +
463  size_t view_screenline_goto(View *view, int n) {
464         size_t pos = view->start;
465         for (Line *line = view->topline; --n > 0 && line != view->lastline; line = line->next)
466 diff --git a/view.h b/view.h
467 index 31b044b8..65bcb29d 100644
468 --- a/view.h
469 +++ b/view.h
470 @@ -358,6 +358,8 @@ void view_options_set(View*, enum UiOption options);
471  enum UiOption view_options_get(View*);
472  void view_colorcolumn_set(View*, int col);
473  int view_colorcolumn_get(View*);
474 +void view_wrapcolumn_set(View*, int col);
475 +void view_breakat_set(View*, const char *breakat);
476  
477  /** Set how many spaces are used to display a tab `\t` character. */
478  void view_tabwidth_set(View*, int tabwidth);
479 diff --git a/vis-cmds.c b/vis-cmds.c
480 index f5221d14..e2bff70d 100644
481 --- a/vis-cmds.c
482 +++ b/vis-cmds.c
483 @@ -364,6 +364,12 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Select
484         case OPTION_IGNORECASE:
485                 vis->ignorecase = toggle ? !vis->ignorecase : arg.b;
486                 break;
487 +       case OPTION_BREAKAT:
488 +               view_breakat_set(win->view, arg.s);
489 +               break;
490 +       case OPTION_WRAP_COLUMN:
491 +               view_wrapcolumn_set(win->view, arg.i);
492 +               break;
493         default:
494                 if (!opt->func)
495                         return false;
496
497 From ee36292c44370678f261ea843c3ebcf02fa19156 Mon Sep 17 00:00:00 2001
498 From: Andrey Proskurin <>
499 Date: Fri, 14 May 2021 16:44:44 +0000
500 Subject: [PATCH 4/5] view.c: check return value of strdup
501
502 ---
503  view.c     | 32 +++++++++++++++++---------------
504  view.h     |  2 +-
505  vis-cmds.c |  5 ++++-
506  3 files changed, 22 insertions(+), 17 deletions(-)
507
508 diff --git a/view.c b/view.c
509 index 79fc7bc1..f1864e8b 100644
510 --- a/view.c
511 +++ b/view.c
512 @@ -273,11 +273,11 @@ static bool view_addch(View *view, Cell *cell) {
513                 return view_expand_tab(view, cell);
514         case '\n':
515                 return view_expand_newline(view, cell);
516 -       case ' ':
517 +       case ' ': {
518                 const char *symbol = view->symbols[SYNTAX_SYMBOL_SPACE]->symbol;
519                 strncpy(cell->data, symbol, sizeof(cell->data) - 1);
520                 return view_add_cell(view, cell);
521 -       }
522 +       }}
523  
524         if (ch < 128 && !isprint(ch)) {
525                 /* non-printable ascii char, represent it as ^(char + 64) */
526 @@ -541,29 +541,27 @@ View *view_new(Text *text) {
527         View *view = calloc(1, sizeof(View));
528         if (!view)
529                 return NULL;
530 -       view->text = text;
531 -       if (!view_selections_new(view, 0)) {
532 -               view_free(view);
533 -               return NULL;
534 -       }
535  
536 +       view->text = text;
537 +       view->tabwidth = 8;
538 +       view->breakat = strdup("");
539 +       view->wrapcolumn = 0;
540         view->cell_blank = (Cell) {
541                 .width = 0,
542                 .len = 0,
543                 .data = " ",
544         };
545 -       view->tabwidth = 8;
546 -       view->breakat = strdup("");
547 -       view->wrapcolumn = 0;
548         view_options_set(view, 0);
549  
550 -       if (!view_resize(view, 1, 1)) {
551 +       if (!view->breakat ||
552 +           !view_selections_new(view, 0) ||
553 +           !view_resize(view, 1, 1))
554 +       {
555                 view_free(view);
556                 return NULL;
557         }
558 -
559 +       
560         view_cursor_to(view, 0);
561 -
562         return view;
563  }
564  
565 @@ -903,9 +901,13 @@ void view_wrapcolumn_set(View *view, int col) {
566                 view->wrapcolumn = col;
567  }
568  
569 -void view_breakat_set(View *view, const char *breakat) {
570 +bool view_breakat_set(View *view, const char *breakat) {
571 +       char *copy = strdup(breakat);
572 +       if (!copy)
573 +               return false;
574         free(view->breakat);
575 -       view->breakat = strdup(breakat);
576 +       view->breakat = copy;
577 +       return true;
578  }
579  
580  size_t view_screenline_goto(View *view, int n) {
581 diff --git a/view.h b/view.h
582 index 65bcb29d..dadecb48 100644
583 --- a/view.h
584 +++ b/view.h
585 @@ -359,7 +359,7 @@ enum UiOption view_options_get(View*);
586  void view_colorcolumn_set(View*, int col);
587  int view_colorcolumn_get(View*);
588  void view_wrapcolumn_set(View*, int col);
589 -void view_breakat_set(View*, const char *breakat);
590 +bool view_breakat_set(View*, const char *breakat);
591  
592  /** Set how many spaces are used to display a tab `\t` character. */
593  void view_tabwidth_set(View*, int tabwidth);
594 diff --git a/vis-cmds.c b/vis-cmds.c
595 index e2bff70d..d3b5f89a 100644
596 --- a/vis-cmds.c
597 +++ b/vis-cmds.c
598 @@ -365,7 +365,10 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Select
599                 vis->ignorecase = toggle ? !vis->ignorecase : arg.b;
600                 break;
601         case OPTION_BREAKAT:
602 -               view_breakat_set(win->view, arg.s);
603 +               if (!view_breakat_set(win->view, arg.s)) {
604 +                       vis_info_show(vis, "Failed to set breakat");
605 +                       return false;
606 +               }
607                 break;
608         case OPTION_WRAP_COLUMN:
609                 view_wrapcolumn_set(win->view, arg.i);
610
611 From f698e53e4772497c41a12288339e3841dbca9680 Mon Sep 17 00:00:00 2001
612 From: Andrey Proskurin <andreyproskurin@protonmail.com>
613 Date: Fri, 14 May 2021 18:46:20 +0000
614 Subject: [PATCH 5/5] view.c: add utf-8 support to `breakat`
615
616 ---
617  view.c | 2 +-
618  1 file changed, 1 insertion(+), 1 deletion(-)
619
620 diff --git a/view.c b/view.c
621 index f1864e8b..a399dd02 100644
622 --- a/view.c
623 +++ b/view.c
624 @@ -260,7 +260,7 @@ static bool view_addch(View *view, Cell *cell) {
625                 return false;
626  
627         unsigned char ch = (unsigned char)cell->data[0];
628 -       bool ch_breakat = strchr(view->breakat, ch);
629 +       bool ch_breakat = strstr(view->breakat, cell->data);
630         if (view->prevch_breakat && !ch_breakat) {
631                 /* this is a good place to wrap line if needed */
632                 view->wrapcol = view->col;