Skip to content

Commit c4a9566

Browse files
committed
Fix `json-par-beginning-of-object-value' at end of one-line object
When the following condition mets, move just after the colon: * The surrounding object is one-line. * The value is missing. * No comments between the colon and the close bracket. Example: { "abc|": } ↓ { "abc": | } where "|" represents the point.
1 parent 14d5a04 commit c4a9566

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

json-par-motion.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,22 @@ If PARSED is given, it is used instead of calling
325325
(json-par--forward-spaces)
326326
(when (memq (char-after) '(?\] ?\) ?}))
327327
(goto-char (json-par-token-end (gethash :colon-token parsed)))
328-
(skip-chars-forward "\s\t")))
328+
(skip-chars-forward "\s\t")
329+
(when (memq (char-after) '(?\] ?\) ?}))
330+
(goto-char (json-par-token-end (gethash :colon-token parsed)))
331+
(when (memq (char-after) '(?\s ?\t))
332+
(forward-char)))))
329333

330334
((gethash :key-token parsed)
331335
(goto-char (json-par-token-end (gethash :key-token parsed)))
332336
(json-par--forward-spaces)
333337
(when (memq (char-after) '(?\] ?\) ?}))
334338
(goto-char (json-par-token-end (gethash :key-token parsed)))
335-
(skip-chars-forward "\s\t")))
339+
(skip-chars-forward "\s\t")
340+
(when (memq (char-after) '(?\] ?\) ?}))
341+
(goto-char (json-par-token-end (gethash :key-token parsed)))
342+
(when (memq (char-after) '(?\s ?\t))
343+
(forward-char)))))
336344

337345
(t
338346
(goto-char (gethash :end-of-member parsed)))))

0 commit comments

Comments
 (0)