d1vanov/libquentier

'Format as source code' button produces an internal error if text isn't selected

Closed this issue · 2 comments

libquentier/src/note_editor/NoteEditor_p.cpp @ 1526 [Warn]: Internal error: can't format the selection as source code: Selected text is empty
src/MainWindow.cpp @ 2903 [Info]: MainWindow::onNoteEditorError: Note editor error, Internal error: can't format the selection as source code: note "test"

Need to think how to solve it in most proper way - currently there's no distinction between "can't do that" and "OMG I screwed up, bail out right into the user's face", sourceCodeFormatter.js just sends status = false and error text to C++ code. Probably need to introduce either some other return code or maybe some policy - in "can't do that" case can return status = true but nonempty error text.

Fixed in commit 98c8dc7 in branch development.