summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af6a330)
raw | patch | inline | side by side (parent: af6a330)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Fri, 10 Aug 2012 11:21:39 +0000 (13:21 +0200) | ||
committer | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Fri, 10 Aug 2012 11:21:39 +0000 (13:21 +0200) |
src/screen_lyrics.c | patch | blob | history |
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 604a051579ed87a982f8c15443396b92fddb011c..881db2989421b27682959df75a5331a15276e268 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
static struct mpd_song *next_song;
static bool follow = false;
+/** Set if the cursor position shall be kept during the next lyrics update. */
+static bool reloading = false;
static struct {
struct mpd_song *song;
static void
screen_lyrics_set(const GString *str)
{
- screen_text_set(&text, str->str);
+ if (reloading) {
+ unsigned saved_start = text.lw->start;
+
+ screen_text_set(&text, str->str);
+
+ /* restore the cursor and ensure that it's still valid */
+ text.lw->start = saved_start;
+ list_window_fetch_cursor(text.lw);
+ } else {
+ screen_text_set(&text, str->str);
+ }
+
+ reloading = false;
/* paint new data */
{
if (current.loader == NULL && current.artist != NULL &&
current.title != NULL) {
+ reloading = true;
current.loader = lyrics_load(current.artist, current.title,
screen_lyrics_callback, NULL);
screen_text_repaint(&text);