Changeset View
Changeset View
Standalone View
Standalone View
src/utils/katetemplatehandler.cpp
Show First 20 Lines • Show All 321 Lines • ▼ Show 20 Line(s) | 311 | while ( fieldMatch.hasNext() ) { | |||
---|---|---|---|---|---|
322 | auto contents = match.captured(1); | 322 | auto contents = match.captured(1); | ||
323 | TemplateField f; | 323 | TemplateField f; | ||
324 | f.range.reset(createMovingRangeForMatch(match)); | 324 | f.range.reset(createMovingRangeForMatch(match)); | ||
325 | f.identifier = contents; | 325 | f.identifier = contents; | ||
326 | f.kind = TemplateField::Editable; | 326 | f.kind = TemplateField::Editable; | ||
327 | if ( defaultMatch.hasMatch() ) { | 327 | if ( defaultMatch.hasMatch() ) { | ||
328 | // the field has a default value, i.e. ${foo=3} | 328 | // the field has a default value, i.e. ${foo=3} | ||
329 | f.defaultValue = defaultMatch.captured(1); | 329 | f.defaultValue = defaultMatch.captured(1); | ||
330 | f.identifier = contents.split(QLatin1Char('=')).at(0).trimmed(); | 330 | f.identifier = contents.leftRef(contents.indexOf(QLatin1Char('='))).trimmed().toString(); | ||
331 | } | 331 | } | ||
332 | else if ( f.identifier.contains(QLatin1Char('(')) ) { | 332 | else if ( f.identifier.contains(QLatin1Char('(')) ) { | ||
333 | // field is a function call when it contains an opening parenthesis | 333 | // field is a function call when it contains an opening parenthesis | ||
334 | f.kind = TemplateField::FunctionCall; | 334 | f.kind = TemplateField::FunctionCall; | ||
335 | } | 335 | } | ||
336 | else if ( f.identifier == QLatin1String("cursor") ) { | 336 | else if ( f.identifier == QLatin1String("cursor") ) { | ||
337 | // field marks the final cursor position | 337 | // field marks the final cursor position | ||
338 | f.kind = TemplateField::FinalCursorPosition; | 338 | f.kind = TemplateField::FinalCursorPosition; | ||
▲ Show 20 Lines • Show All 223 Lines • Show Last 20 Lines |