mirror of
https://github.com/textmate/textmate.git
synced 2026-01-22 13:17:55 -05:00
Use current indent for lines matching the “ignore” pattern
This is only when explicitly asking TextMate to indent the current line / selection. Previously these lines would remain at their current indent, this is useful for preprocessor commands, but majority of ignored lines should use current indent. It might be useful to introduce a new pattern for “zero indent” lines.
This commit is contained in:
@@ -1068,13 +1068,15 @@ namespace ng
|
||||
{
|
||||
size_t bol = _buffer.begin(n);
|
||||
size_t eos = bol;
|
||||
if(fsm.is_ignored(_buffer.substr(bol, _buffer.eol(n))))
|
||||
|
||||
std::string const line = _buffer.substr(bol, _buffer.eol(n));
|
||||
if(text::is_blank(line.data(), line.data() + line.size()))
|
||||
continue;
|
||||
|
||||
while(eos != _buffer.size() && text::is_whitespace(_buffer[eos]))
|
||||
eos += _buffer[eos].size();
|
||||
|
||||
replacements.insert(std::make_pair(range_t(bol, eos), indent::create(fsm.scan_line(_buffer.substr(bol, _buffer.eol(n))), _buffer.indent().tab_size(), _buffer.indent().soft_tabs())));
|
||||
replacements.insert(std::make_pair(range_t(bol, eos), indent::create(fsm.scan_line(line), _buffer.indent().tab_size(), _buffer.indent().soft_tabs())));
|
||||
}
|
||||
|
||||
if(!replacements.empty())
|
||||
|
||||
Reference in New Issue
Block a user