File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 8686 (insert , instruction " \n\n " )
8787 ,@body )))
8888
89+ (defun codegpt--fill-region (start end )
90+ " Like function `fill-region' (START to END), improve readability."
91+ (save-restriction
92+ (narrow-to-region start end)
93+ (goto-char (point-min ))
94+ (while (not (eobp ))
95+ (end-of-line )
96+ (when (< fill-column (current-column ))
97+ (fill-region (line-beginning-position ) (line-end-position )))
98+ (forward-line 1 ))))
99+
89100(defun codegpt--internal (instruction start end )
90101 " Do INSTRUCTION with partial code.
91102
@@ -104,7 +115,7 @@ boundaries of that region in buffer."
104115 (result (openai--get-choice choices))
105116 (original-point (point )))
106117 (insert (string-trim result) " \n " )
107- (fill-region original-point (point ))))
118+ (codegpt-- fill-region original-point (point ))))
108119 (unless codegpt-focus-p
109120 (select-window original-window)))
110121 :model codegpt-model
You can’t perform that action at this time.
0 commit comments