From 81f8cc4e29e5514ecf0ca3d04df7ff202b421f91 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Mon, 18 Feb 2013 15:34:29 +0100 Subject: [PATCH] =?UTF-8?q?Use=20current=20indent=20for=20lines=20matching?= =?UTF-8?q?=20the=20=E2=80=9Cignore=E2=80=9D=20pattern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Frameworks/editor/src/editor.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Frameworks/editor/src/editor.cc b/Frameworks/editor/src/editor.cc index 33b5f664..3f1a02f5 100644 --- a/Frameworks/editor/src/editor.cc +++ b/Frameworks/editor/src/editor.cc @@ -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())