Changeset d3c318b for fmtext.c


Ignore:
Timestamp:
Feb 4, 2011, 3:49:44 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
7e111f4
Parents:
dfe5829
git-author:
David Benjamin <davidben@mit.edu> (01/24/11 20:37:26)
git-committer:
David Benjamin <davidben@mit.edu> (02/04/11 15:49:44)
Message:
Don't stick random NULs when waddnstr exists
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    r7ba2ad4 rd3c318b  
    301301      if (do_search && owl_global_is_search_active(&g)) {
    302302        /* Search is active, so highlight search results. */
    303         char tmp2;
    304303        int start, end;
    305304        while (owl_regex_compare(owl_global_get_search_re(&g), s, &start, &end) == 0) {
     
    310309          /* Found search string, highlight it. */
    311310
    312           tmp2 = s[start];
    313           s[start] = '\0';
    314           waddstr(w, s);
    315           s[start] = tmp2;
     311          waddnstr(w, s, start);
    316312
    317313          _owl_fmtext_wattrset(w, attr ^ OWL_FMTEXT_ATTR_REVERSE);
    318314          _owl_fmtext_wcolor_set(w, pair);
    319315         
    320           tmp2 = s[end];
    321           s[end] = '\0';
    322           waddstr(w, s + start);
    323           s[end] = tmp2;
     316          waddnstr(w, s + start, end - start);
    324317
    325318          _owl_fmtext_wattrset(w, attr);
Note: See TracChangeset for help on using the changeset viewer.