diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index d0dfd84..d6b8ab3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -111,6 +111,29 @@ Interface::process_notify(SCNotification *notify) #endif } +void +String::get_coord(const gchar *str, gint pos, + gint &line, gint &column) +{ + line = column = 1; + + for (gint i = 0; i < pos; i++) { + switch (str[i]) { + case '\r': + if (str[i+1] == '\n') + i++; + /* fall through */ + case '\n': + line++; + column = 1; + break; + default: + column++; + break; + } + } +} + #ifdef G_OS_WIN32 /* |