Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'lines,': 0.07; 'notice,': 0.07; 'string': 0.09; 'arrays': 0.09; 'bits': 0.09; 'insertion': 0.09; 'oh,': 0.09; 'section,': 0.09; 'strings.': 0.09; 'language,': 0.12; 'sections': 0.14; 'character.': 0.16; 'deletion': 0.16; 'editor,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hint:': 0.16; 'pity': 0.16; 'rough': 0.16; 'simplest': 0.16; 'which...': 0.16; '(you': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'coding': 0.22; 'color,': 0.24; 'string,': 0.24; "i've": 0.25; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'quickly': 0.29; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'libraries': 0.31; 'allows': 0.31; 'text': 0.33; 'display': 0.35; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'scheme': 0.36; 'list': 0.37; 'form,': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'most': 0.60; 'color': 0.61; 'provide': 0.64; 'different': 0.65; 'series': 0.66; 'jul': 0.74; 'paper': 0.75; 'sheet': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ZkBHZOlL+TFFHXjLFFpCtsm6+bnHv0ATl50hYJPaOOQ=; b=yMFW9ma0uHasuWKIVYqSEHmfrW2k6Qvc/8dl4dO/xgh/LU78Lj9iDM8aQqfKVLYlVD 6TD2rnyd7rAV1ou0Uez8IaTW3W1ZyGdq10+j2RO/AtEzZV4EwIiH+FmZyKS6xtwr5TmM kBQzRDWT9Hhg7ZPO0nNHmel+oSBWZDpE+A7s8OtTAphwmACBDNMsA0dDoBudsFrErnFl zhYODnFezugXQ0zj3439nrSqn3eTVPkVPYfkND9G5+H2oXkXGi+5MzY9cfQ/zJvQ8YmR Spxd5zo46yZNGlWjCfcvc4D4MUYqHegDNmaqCSbGnnOOmDz1rfeioZy87AnAKVEhjQOM 0XiQ== MIME-Version: 1.0 X-Received: by 10.58.187.4 with SMTP id fo4mr26173226vec.55.1373708800367; Sat, 13 Jul 2013 02:46:40 -0700 (PDT) In-Reply-To: <2165f7cc-b9bf-41b1-b128-d33b522046dc@googlegroups.com> References: <7ef8c0e7-7f7c-4a22-89a9-50f62c4a8064@googlegroups.com> <26d5c832-eaa1-439e-af61-e2855af2cd18@googlegroups.com> <2165f7cc-b9bf-41b1-b128-d33b522046dc@googlegroups.com> Date: Sat, 13 Jul 2013 19:46:40 +1000 Subject: Re: hex dump w/ or w/out utf-8 chars From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373708809 news.xs4all.nl 15976 [2001:888:2000:d::a6]:51075 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50587 On Sat, Jul 13, 2013 at 5:56 PM, wrote: > Try to write an editor, a text widget, with with a coding > scheme like the Flexible String Represenation. You will > quickly notice, it is impossible (understand correctly). > (You do not need a computer, just a sheet of paper and a pencil) > Hint: what is the character at the caret position? I would use an internal representation that allows insertion and deletion - in its simplest form, a list of strings. And those strings would be whatever I can most conveniently work with. I've never built a text editor widget, because my libraries always provide them. But there is a rough parallel in the display storage for Gypsum, which stores a series of lines, each of which is a series of sections in different colors. (A line might be a single section, ie one color for its whole length.) I store them in arrays of (color, string, color, string, color, string...). The strings I use are in the format wanted by my display subsystem - which in my case is the native string type of the language, which... oh, what a pity for jmf, is a flexible object that uses 8, 16, or 32 bits for each character. ChrisA