imh

Check-in [3a255d5281]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Accomodate "pick -subj FOO" without blowing up on trying to parse -subj as message range.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:3a255d52812e72c7e79728f21ee8c3c09fcd2c9341a4314cd876e31448eaa246
User & Date: ajv-899-334-8894@vsta.org 2016-12-05 22:40:32
Context
2018-07-10
00:31
tauthon defend against non-ASCII encoding check-in: d77c22265d user: vandys tags: master, trunk
2016-12-05
22:40
Accomodate "pick -subj FOO" without blowing up on trying to parse -subj as message range. check-in: 3a255d5281 user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-12-04
22:37
Support "last" (and "first") so we can do "show 7-last" check-in: b3c9234fa2 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to imh.py.

340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
...
355
356
357
358
359
360
361


362


363
364
365
366
367



368
369
370
371
372
373
374
    def _parse_one(self, arg, fmsgs):
        if arg.isdigit():
            return int(arg)
        if arg == "first":
            return 1
        if arg == "last":
            return fmsgs
        raise Exception, "Unknown message number: %r\n" % (arg,)

    def parse_range(self, fmsgs):
        res = set()
        while True:
            if not self.args:
                break
            a = self.args[0]
................................................................................

            # low-high
            if '-' in a:
                tup = a.split('-')
                if len(tup) != 2:
                    raise Exception, "Bad message range %s" % (a,)
                l = self._parse_one(tup[0], fmsgs)


                h = self._parse_one(tup[1], fmsgs)


                res.update(xrange(l,h+1))

            else:
                # Just a message number
                res.add(self._parse_one(a, fmsgs))




            # We've consumed this
            del self.args[0]

        return sorted(res)

    # Parse mail file style fields, where continuations







|







 







>
>

>
>




|
>
>
>







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
...
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
    def _parse_one(self, arg, fmsgs):
        if arg.isdigit():
            return int(arg)
        if arg == "first":
            return 1
        if arg == "last":
            return fmsgs
        return None

    def parse_range(self, fmsgs):
        res = set()
        while True:
            if not self.args:
                break
            a = self.args[0]
................................................................................

            # low-high
            if '-' in a:
                tup = a.split('-')
                if len(tup) != 2:
                    raise Exception, "Bad message range %s" % (a,)
                l = self._parse_one(tup[0], fmsgs)
                if l is None:
                    break
                h = self._parse_one(tup[1], fmsgs)
                if h is None:
                    break
                res.update(xrange(l,h+1))

            else:
                # Just a message number
                m = self._parse_one(a, fmsgs)
                if m is None:
                    break
                res.add(m)

            # We've consumed this
            del self.args[0]

        return sorted(res)

    # Parse mail file style fields, where continuations