Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions kilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void editorUpdateSyntax(erow *row) {
/* Handle // comments. */
if (prev_sep && *p == scs[0] && *(p+1) == scs[1]) {
/* From here to end is a comment */
memset(row->hl+i,HL_COMMENT,row->size-i);
memset(row->hl+i,HL_COMMENT,row->rsize-i);
return;
}

Expand Down Expand Up @@ -442,7 +442,7 @@ void editorUpdateSyntax(erow *row) {
/* Handle "" and '' */
if (in_string) {
row->hl[i] = HL_STRING;
if (*p == '\\') {
if (*p == '\\' && *(p+1)) {
row->hl[i+1] = HL_STRING;
p += 2; i += 2;
prev_sep = 0;
Expand Down Expand Up @@ -481,12 +481,13 @@ void editorUpdateSyntax(erow *row) {
/* Handle keywords and lib calls */
if (prev_sep) {
int j;
int ileft = row->rsize - i;
for (j = 0; keywords[j]; j++) {
int klen = strlen(keywords[j]);
int kw2 = keywords[j][klen-1] == '|';
if (kw2) klen--;

if (!memcmp(p,keywords[j],klen) &&
if (klen < ileft && !memcmp(p,keywords[j],klen) &&
is_separator(*(p+klen)))
{
/* Keyword */
Expand Down