[Gd-chatter] r11588 - in trunk/fundev/sources: deuce system/tests
cgay at gwydiondylan.org
cgay at gwydiondylan.org
Sat Dec 29 18:54:49 CET 2007
Author: cgay
Date: Sat Dec 29 18:54:49 2007
New Revision: 11588
Modified:
trunk/fundev/sources/deuce/editor.dylan
trunk/fundev/sources/system/tests/locators.dylan
Log:
job: 4835
Fix editor bug "Buffers can become duplicated". See bug for details.
Modified: trunk/fundev/sources/deuce/editor.dylan
==============================================================================
--- trunk/fundev/sources/deuce/editor.dylan (original)
+++ trunk/fundev/sources/deuce/editor.dylan Sat Dec 29 18:54:49 2007
@@ -93,18 +93,36 @@
define method find-buffer
(editor :: <basic-editor>, name :: <byte-string>)
=> (buffer :: false-or(<basic-buffer>))
- let buffers = editor-buffers(editor);
- find-value(buffers,
- //--- Should this use case-insensitive compare?
- method (b) buffer-name(b) = name end)
+ find-buffer(editor, method (b) buffer-name(b) = name end)
+end method find-buffer;
+
+define method find-buffer
+ (editor :: <basic-editor>, test-function :: <function>)
+ find-value(editor-buffers(editor), test-function)
end method find-buffer;
define method find-buffer-from-pathname
(editor :: <basic-editor>, pathname :: <pathname>)
=> (buffer :: false-or(<basic-buffer>))
- find-buffer(editor, pathname->buffer-name(pathname))
+ let locator = as(<file-locator>, pathname);
+ find-buffer(editor, rcurry(buffer-source-location-equals, locator))
end method find-buffer-from-pathname;
+define method buffer-source-location-equals
+ (buffer :: <buffer>, locator :: <file-locator>)
+ debug-message("NFB: %=\n", buffer-name(buffer));
+ #f
+end method buffer-source-location-equals;
+
+define method buffer-source-location-equals
+ (buffer :: <file-buffer-mixin>, locator :: <file-locator>)
+ let buffer-pathname = container-pathname(buffer-source-container(buffer));
+ let same? = (as(<file-locator>, buffer-pathname) = locator);
+ debug-message("%= = %=? %s\n",
+ as(<string>, locator), buffer-pathname, same?);
+ same?
+end method buffer-source-location-equals;
+
/// Editor frames
Modified: trunk/fundev/sources/system/tests/locators.dylan
==============================================================================
--- trunk/fundev/sources/system/tests/locators.dylan (original)
+++ trunk/fundev/sources/system/tests/locators.dylan Sat Dec 29 18:54:49 2007
@@ -250,6 +250,7 @@
define constant $microsoft-subdirectory-tests
= #[#["h:/a/", #["b"], "h:/a/b/"],
+ #["h:/a/", #["b"], "H:/a/b/"],
#["//h/a/", #["b"], "//h/a/b/"]];
define locators function-test subdirectory-locator ()
More information about the chatter
mailing list