docs: def _get_completions(self):
          """Return a list of possible completions for the string ending at the point.
          Also set begidx and endidx in the process."""
          completions = []
          self.begidx = self.l_buffer.point
          self.endidx = self.l_buffer.point
          buf=self.l_buffer.line_buffer
          if self.completer:
              # get the string to complete
              while self.begidx > 0:
                  self.begidx -= 1
                  if buf[self.begidx] in self.completer_delims:
                      self.begidx += 1
                      break
              text = ensure_str(u''.join(buf[self.begidx:self.endidx]))
              log(u'complete text="%s"' % ensure_unicode(text))
              i = 0
              while 1:
                  try:
                      r = ensure_unicode(self.completer(text, i))
                  except IndexError:
                      break
                  i += 1
                  if r is None:
                      break
                  elif r and r not in completions:
                      completions.append(r)
                  else:
                      pass
              log(u'text completions=<%s>' % map(ensure_unicode, completions))
          if (self.complete_filesystem == "on") and not completions:
              # get the filename to complete
              while self.begidx > 0:
                  self.begidx -= 1
                  if buf[self.begidx] in u' \t\n':
                      self.begidx += 1
                      break
              text = ensure_str(u''.join(buf[self.begidx:self.endidx]))
              log(u'file complete text="%s"' % ensure_unicode(text))
              completions = map(ensure_unicode, glob.glob(os.path.expanduser(text) + '*'))
              if self.mark_directories == u'on':
                  mc = []
                  for f in completions:
                      if os.path.isdir(f):
                          mc.append(f + os.sep)
                      else:
                          mc.append(f)
                  completions = mc
              log(u'fnames=<%s>' % map(ensure_unicode, completions))
          return completions