From bf9ecb580dd66593a143847f81fedc1149a4e2b1 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Wed, 9 May 2018 20:10:41 +0200 Subject: [PATCH] Fix `logview-go-to-message-beginning' no longer activating region if called with prefix argument in Transient Mark mode. --- logview.el | 2 +- test/log4j/navigation-1.log | 15 +++++++++++++++ test/logview.el | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 test/log4j/navigation-1.log diff --git a/logview.el b/logview.el index 141ee36..436a944 100644 --- a/logview.el +++ b/logview.el @@ -935,7 +935,7 @@ Transient Mark mode also activate the region." (logview--locate-current-entry entry start (goto-char (logview--entry-message-start entry start)) (when select-message - (push-mark (logview--entry-end entry start)))) + (push-mark (logview--linefeed-back (logview--entry-end entry start)) t t))) (unless (and select-message transient-mark-mode) (logview--maybe-pulse-current-entry 'message-beginning)))) diff --git a/test/log4j/navigation-1.log b/test/log4j/navigation-1.log new file mode 100644 index 0000000..4ece8e7 --- /dev/null +++ b/test/log4j/navigation-1.log @@ -0,0 +1,15 @@ +2010-01-01 01:01:01.111 [thread 1] INFO class1 - message 1 +2010-01-01 01:01:01.111 [thread 1] DEBUG class1 - message 2 +2010-01-01 01:01:01.111 [thread 1] DEBUG class1 - message 3 +2010-01-01 01:01:01.111 [thread 1] TRACE class1 - message 4 +trace details, line 1 +trace details, line 2 +trace details, line 3 +2010-01-01 01:01:01.111 [thread 1] INFO class1 - message 5 +2010-01-01 01:01:01.111 [thread 1] WARN class1 - message 6 +warning details +2010-01-01 01:01:01.111 [thread 1] DEBUG class1 - message 7 +2010-01-01 01:01:01.111 [thread 1] DEBUG class1 - message 8 +2010-01-01 01:01:01.111 [thread 1] INFO class1 - message 9 +2010-01-01 01:01:01.111 [thread 1] ERROR class1 - message 10 +error details diff --git a/test/logview.el b/test/logview.el index 589ba6f..9a1a152 100644 --- a/test/logview.el +++ b/test/logview.el @@ -68,3 +68,20 @@ ;; Make sure that the second line is also recognized as an entry. ;; If it isn't, this will signal an error. (logview-next-entry))) + +(ert-deftest logview-test-go-to-message-beginning-1 () + (logview--test-with-file "log4j/navigation-1.log" + (should (equal logview--submode-name "SLF4J")) + (forward-line 2) + (logview-go-to-message-beginning) + (should (looking-at "message 3$")))) + +(ert-deftest logview-test-go-to-message-beginning-2 () + (logview--test-with-file "log4j/navigation-1.log" + (should (equal logview--submode-name "SLF4J")) + (transient-mark-mode 1) + (forward-line 2) + (logview-go-to-message-beginning t) + (should (looking-at "message 3$")) + (should (string= (buffer-substring-no-properties (region-beginning) (region-end)) "message 3")) + (should (use-region-p))))