about summary refs log tree commit diff stats
path: root/README
Commit message (Collapse)AuthorAgeFilesLines
* added hint for downloading dextraAnselm R. Garbe2007-10-011-0/+3
|
* small change to READMEAnselm R. Garbe2006-09-281-1/+1
|
* updated README 1.7arg@mmvi2006-09-261-1/+1
|
* small changes to dwm.1, rearranged order within main event loopAnselm R.Garbe2006-08-211-1/+1
|
* applied Sanders doc changes, added a PHONY line and changed the output of ↵arg@10ksloc.org2006-08-031-1/+2
| | | | config.h creation somewhat
* implemented the idea presented by Sander for dwm targetarg@10ksloc.org2006-08-021-2/+1
|
* fixed a type in README, and patched config.mkarg@10ksloc.org2006-08-021-1/+1
|
* removed the CONFIG variable from config.mk, renamed config.h into ↵arg@10ksloc.org2006-08-021-5/+1
| | | | config.default.h, after first clone/extract one needs to copy config.default.h to config.h, that is easier than always heavy typing make CONFIG=blafasel
* simplified READMEarg@10ksloc.org2006-08-011-4/+1
|
* centralized/externalized configuration to config.harg@10ksloc.org2006-08-011-2/+6
|
* applied Sanders patchesarg@10ksloc.org2006-08-011-8/+9
|
* s/sleep 5/sleep 2/arg@10ksloc.org2006-07-211-1/+1
|
* changed the status info README hint (more simple now, no extra script necessary)arg@10ksloc.org2006-07-211-7/+1
|
* added a note how to achieve status info in the bararg@10ksloc.org2006-07-211-1/+17
|
* updated READMEAnselm R. Garbe2006-07-171-2/+2
|
* added dev.c instead of kb.cAnselm R. Garbe2006-07-131-1/+1
|
* small changes to READMEAnselm R. Garbe2006-07-131-3/+3
|
* added logo+descriptionAnselm R. Garbe2006-07-131-13/+12
|
* removed unnecessary crapAnselm R. Garbe2006-07-131-4/+2
|
* added mouse-based resizalsAnselm R. Garbe2006-07-111-9/+1
|
* updated READMEAnselm R. Garbe2006-07-111-5/+15
|
* fixed several stuff (gridwm gets better and better)Anselm R. Garbe2006-07-111-0/+1
|
* initial importAnselm R. Garbe2006-07-101-0/+40
;"Return the width of a string""" if not PY3: string = string.decode('utf-8', 'ignore') return sum(utf_char_width(c) for c in string) def uchars(string): """Return a list of characters in a string""" if not PY3: string = string.decode('utf-8', 'ignore') return list(string) def utf_char_width(string): """Return the width of a single character""" if east_asian_width(string) in WIDE_SYMBOLS: return WIDE return NARROW def string_to_charlist(string): """Return a list of characters with extra empty strings after wide chars""" if not set(string) - ASCIIONLY: return list(string) result = [] if PY3: for c in string: result.append(c) if east_asian_width(c) in WIDE_SYMBOLS: result.append('') else: string = string.decode('utf-8', 'ignore') for c in string: result.append(c.encode('utf-8')) if east_asian_width(c) in WIDE_SYMBOLS: result.append('') return result class WideString(object): def __init__(self, string, chars=None): self.string = string if chars is None: self.chars = string_to_charlist(string) else: self.chars = chars def __add__(self, string): """ >>> (WideString("a") + WideString("b")).string 'ab' >>> (WideString("a") + WideString("b")).chars ['a', 'b'] >>> (WideString("afd") + "bc").chars ['a', 'f', 'd', 'b', 'c'] """ if isinstance(string, str): return WideString(self.string + string) elif isinstance(string, WideString): return WideString(self.string + string.string, self.chars + string.chars) def __radd__(self, string): """ >>> ("bc" + WideString("afd")).chars ['b', 'c', 'a', 'f', 'd'] """ if isinstance(string, str): return WideString(string + self.string) elif isinstance(string, WideString): return WideString(string.string + self.string, string.chars + self.chars) def __str__(self): return self.string def __repr__(self): return '<' + self.__class__.__name__ + " '" + self.string + "'>" def __getslice__(self, a, z): """ >>> WideString("asdf")[1:3] <WideString 'sd'> >>> WideString("モヒカン")[2:4] <WideString 'ヒ'> >>> WideString("モヒカン")[2:5] <WideString 'ヒ '> >>> WideString("モabカン")[2:5] <WideString 'ab '> >>> WideString("モヒカン")[1:5] <WideString ' ヒ '> >>> WideString("モヒカン")[:] <WideString 'モヒカン'> >>> WideString("aモ")[0:3] <WideString 'aモ'> >>> WideString("aモ")[0:2] <WideString 'a '> >>> WideString("aモ")[0:1] <WideString 'a'> """ if z is None or z > len(self.chars): z = len(self.chars) if a is None or a < 0: a = 0 if z < len(self.chars) and self.chars[z] == '': if self.chars[a] == '': return WideString(' ' + ''.join(self.chars[a:z - 1]) + ' ') return WideString(''.join(self.chars[a:z - 1]) + ' ') if self.chars[a] == '': return WideString(' ' + ''.join(self.chars[a:z - 1])) return WideString(''.join(self.chars[a:z])) def __getitem__(self, i): """ >>> WideString("asdf")[2] <WideString 'd'> >>> WideString("……")[0] <WideString '…'> >>> WideString("……")[1] <WideString '…'> """ if isinstance(i, slice): return self.__getslice__(i.start, i.stop) return self.__getslice__(i, i+1) def __len__(self): """ >>> len(WideString("poo")) 3 >>> len(WideString("モヒカン")) 8 """ return len(self.chars) if __name__ == '__main__': import doctest doctest.testmod()