#! /bin/sh /usr/share/dpatch/dpatch-run ## 03_reverse_title.dpatch by Paul Wise ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad scite-1.69~/scite/doc/SciTEDoc.html scite-1.69/scite/doc/SciTEDoc.html --- scite-1.69~/scite/doc/SciTEDoc.html 2006-05-21 10:54:53.000000000 +0800 +++ scite-1.69/scite/doc/SciTEDoc.html 2006-06-16 22:31:39.000000000 +0800 @@ -2669,6 +2669,9 @@ Chooses how the file name is displayed in the title bar. When 0 (default) the file name is displayed. When 1 the full path is displayed. When 2 the window title displays "filename in directory". + When 321 makes the window title use the full path, but reversed + (on Windows the drive letter and colon will be also swapped around). + eg H:\SomeLuser\SomePath\SomeDoc.ext -> SomeDoc.ext\SomePath\SomeLuser\:H diff -urNad scite-1.69~/scite/src/SciTEBase.cxx scite-1.69/scite/src/SciTEBase.cxx --- scite-1.69~/scite/src/SciTEBase.cxx 2006-05-23 13:17:42.000000000 +0800 +++ scite-1.69/scite/src/SciTEBase.cxx 2006-06-16 22:30:20.000000000 +0800 @@ -984,6 +984,36 @@ windowName += filePath.Directory().AsInternal(); } else if (props.GetInt("title.full.path") == 1) { windowName = filePath.AsInternal(); + } else if (props.GetInt("title.full.path") == 321) { + char revPath [MAX_PATH]; + char* inStart = fullPath; + char* inEnd = fullPath; + size_t inLen = strlen(fullPath) + 1; + size_t inSubstrLen; + char* outEnd = revPath + inLen - 1; + + for (;;) { + inEnd = strchr(inStart, pathSepChar) ; + if (inEnd == NULL) + inSubstrLen = fullPath + inLen - inStart - 1; + else + inSubstrLen = inEnd - inStart; + outEnd -= inSubstrLen; + memcpy(outEnd, inStart, inSubstrLen); + if (inEnd == NULL) break; + inStart = ++inEnd; + *--outEnd = pathSepChar; + } + +#if PLAT_WIN + // Swap around drive + if (revPath[inLen-2] == ':') { + revPath[inLen-2] = revPath[inLen-3]; + revPath[inLen-3] = ':'; + } +#endif + revPath[inLen-1] = '\0'; + windowName = revPath; } else { windowName = FileNameExt().AsInternal(); }