comparison lisp/textmodes/two-column.el @ 103308:49bdb788956d

* textmodes/two-column.el (2C-split): Call move-to-column, to compensate for the 2007-10-19 change from next-line to forward-line (Bug#3435). Account for fringe and scroll-bar when setting 2C-window-width.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 04 Jun 2009 01:11:06 +0000
parents cc189e8cf211
children da8b3e61b182
comparison
equal deleted inserted replaced
103307:e1566685f778 103308:49bdb788956d
410 (save-excursion 410 (save-excursion
411 (set-buffer (2C-other)) 411 (set-buffer (2C-other))
412 (erase-buffer)) 412 (erase-buffer))
413 (signal 'quit nil))) 413 (signal 'quit nil)))
414 (let ((point (point)) 414 (let ((point (point))
415 ; make next-line always come back to same column 415 ;; make next-line always come back to same column
416 (goal-column (current-column)) 416 (column (current-column))
417 ; a counter for empty lines in other buffer 417 ;; a counter for empty lines in other buffer
418 (n (1- (count-lines (point-min) (point)))) 418 (n (1- (count-lines (point-min) (point))))
419 chars other) 419 chars other)
420 (save-excursion 420 (save-excursion
421 (backward-char arg) 421 (backward-char arg)
422 (setq chars (buffer-substring (point) point)) 422 (setq chars (buffer-substring (point) point))
423 (skip-chars-forward " \t" point) 423 (skip-chars-forward " \t" point)
424 (make-local-variable '2C-separator) 424 (make-local-variable '2C-separator)
425 (setq 2C-separator (buffer-substring (point) point) 425 (setq 2C-separator (buffer-substring (point) point)
426 2C-window-width (current-column))) 426 2C-window-width (+ (fringe-columns 'left)
427 (fringe-columns 'right)
428 (scroll-bar-columns 'left)
429 (scroll-bar-columns 'right)
430 (current-column))))
427 (2C-two-columns) 431 (2C-two-columns)
428 (setq other (2C-other)) 432 (setq other (2C-other))
429 ; now we're ready to actually split 433 ;; now we're ready to actually split
430 (save-excursion 434 (save-excursion
431 (while (not (eobp)) 435 (while (not (eobp))
432 (if (not (and (= (current-column) goal-column) 436 (if (not (and (= (current-column) column)
433 (string= chars 437 (string= chars
434 (buffer-substring (point) 438 (buffer-substring (point)
435 (save-excursion 439 (save-excursion
436 (backward-char arg) 440 (backward-char arg)
437 (point)))))) 441 (point))))))
446 (if (eobp) 450 (if (eobp)
447 (point) 451 (point)
448 (1+ (point))))) 452 (1+ (point)))))
449 (delete-region point (point)) 453 (delete-region point (point))
450 (setq n 0)) 454 (setq n 0))
451 (forward-line 1))))) 455 (forward-line 1)
456 (move-to-column column)))))
452 457
453 458
454 459
455 460
456 (defun 2C-dissociate () 461 (defun 2C-dissociate ()