summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-01-21 15:57:21 +0000
committerAndy Williams <andy@andywilliams.me>2017-01-21 15:57:21 +0000
commita0f8cb846ce5f9a62a6581d0fc64a1a48def7817 (patch)
tree4817d9d51acae95b5ad1753c5538f2da2630b7ae
parent65be73c58f91a768c7f7228e3e83863e90a92ade (diff)
elm_code: simpler handling of token painting
-rw-r--r--src/lib/elementary/elm_code_widget.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index 67a5d96c43..fe91214b33 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -168,31 +168,24 @@ _elm_code_widget_fill_line_tokens(Elm_Code_Widget *widget, Evas_Textgrid_Cell *c
168{ 168{
169 Eina_List *item; 169 Eina_List *item;
170 Elm_Code_Token *token; 170 Elm_Code_Token *token;
171 unsigned int start, end, length, offset; 171 unsigned int end, length, offset;
172 unsigned int token_start_col, token_end_col; 172 unsigned int token_start_col, token_end_col;
173 173
174 offset = elm_obj_code_widget_text_left_gutter_width_get(widget); 174 offset = elm_obj_code_widget_text_left_gutter_width_get(widget);
175 start = offset;
176 length = elm_code_widget_line_text_column_width_get(widget, line) + offset; 175 length = elm_code_widget_line_text_column_width_get(widget, line) + offset;
176 _elm_code_widget_fill_line_token(cells, count, offset, length, ELM_CODE_TOKEN_TYPE_DEFAULT);
177 177
178 EINA_LIST_FOREACH(line->tokens, item, token) 178 EINA_LIST_FOREACH(line->tokens, item, token)
179 { 179 {
180 token_start_col = elm_code_widget_line_text_column_width_to_position(widget, line, token->start) + offset; 180 token_start_col = elm_code_widget_line_text_column_width_to_position(widget, line, token->start) + offset;
181 token_end_col = elm_code_widget_line_text_column_width_to_position(widget, line, token->end) + offset; 181 token_end_col = elm_code_widget_line_text_column_width_to_position(widget, line, token->end) + offset;
182 182
183 if (token_start_col > start)
184 _elm_code_widget_fill_line_token(cells, count, start, token_start_col, ELM_CODE_TOKEN_TYPE_DEFAULT);
185
186 // TODO handle a token starting before the previous finishes 183 // TODO handle a token starting before the previous finishes
187 end = token_end_col; 184 end = token_end_col;
188 if (token->continues) 185 if (token->continues)
189 end = length + offset; 186 end = length + offset;
190 _elm_code_widget_fill_line_token(cells, count, token_start_col, end, token->type); 187 _elm_code_widget_fill_line_token(cells, count, token_start_col, end, token->type);
191
192 start = end + 1;
193 } 188 }
194
195 _elm_code_widget_fill_line_token(cells, count, start, length, ELM_CODE_TOKEN_TYPE_DEFAULT);
196} 189}
197 190
198static void 191static void