logic: scroll code when no symbol

Scrolling to line, when comming from plugin and the file is was modified.
Since there we dont know from the position data if the symbol on position is the right one,
we scroll to the line if modified.
This commit is contained in:
Andreas Stallinger
2016-07-28 14:16:15 +02:00
parent acaf58c3f8
commit d5e9cecef3
16 changed files with 139 additions and 22 deletions
@@ -3,6 +3,7 @@
#include <memory>
#include "utility/messaging/type/MessageStatus.h"
#include "utility/messaging/type/MessageScrollToLine.h"
#include "utility/text/TextAccess.h"
#include "utility/tracing.h"
#include "utility/utility.h"
@@ -234,6 +235,26 @@ void CodeController::handleMessage(MessageFocusOut* message)
getView()->defocusTokenIds();
}
void CodeController::handleMessage(MessageScrollToLine* message)
{
getView()->scrollToLine(message->filename, message->line);
if ( message->isModified )
{
MessageStatus(
"File was modified. Showing the File: " + message->filename
+ " at line " + std::to_string(message->line) + " now. Please refresh."
).dispatch();
}
else
{
MessageStatus(
"Showing the File: " + message->filename
+ " at line " + std::to_string(message->line) + "."
).dispatch();
}
}
void CodeController::handleMessage(MessageScrollCode* message)
{
if (message->isReplayed())