plantuml-mode icon indicating copy to clipboard operation
plantuml-mode copied to clipboard

newpage doesn't work as expected

Open c02y opened this issue 7 years ago • 3 comments

when previewing a plantuml file contains newpage keyword, the image preview buffer contains only one image(image generated from the first part of the code), but I use command like

java -jar /path/to/plantuml.jar test.plantuml

it will generate several images according the newpage keyword correctly.

c02y avatar Jun 19 '17 10:06 c02y

newpage is indeed not currently supported. Patches welcome :-)

skuro avatar Jul 07 '17 16:07 skuro

For future reference: vscode issue #40

skuro avatar May 06 '19 11:05 skuro

I made a trivial hack to get a workaround, here is the elisp code:

(defun plantuml-page-preview (prefix)
  (interactive "p")
  (let ((p (point)))
    (plantuml-page-select)
    (plantuml-preview prefix)
    (deactivate-mark)
    (goto-char p)))
(defun plantuml-page-next ()
  (interactive) (re-search-forward "\\(newpage\\|@enduml\\)" nil 1))
(defun plantuml-page-previous ()
  (interactive) (re-search-backward "\\(newpage\\|@startuml\\)" nil 1))
(defun plantuml-page-select ()
  (when (plantuml-page-previous) (goto-char (match-end 0)))
  (set-mark-command nil)
  (when (plantuml-page-next) (goto-char (match-beginning 0))))

(eval-after-load 'plantuml-mode
  (lambda ()
    (define-key plantuml-mode-map (kbd "C-c C-c") 'plantuml-page-preview)
    (define-key plantuml-mode-map (kbd "C-c C-n") 'plantuml-page-next)
    (define-key plantuml-mode-map (kbd "C-c C-p") 'plantuml-page-previous)))

xinyifly avatar Nov 13 '21 19:11 xinyifly