Bug: result of search not copyed correctly

Steps to reproduce:

Use this document with search query and two projects:

report @search(@done = [d] today and not @unplanned )
First:
	- First
	- Second @today @done(2016-04-06)
Second:
	- First @done(2016-04-06)
	- Second @done(2016-04-06) @unplanned
  1. Use search query
  2. Copy the results
  3. Paste the results in another app

Expected result:

First:
	- Second @today @done(2016-04-06)
Second:
	- First @done(2016-04-06)

Actual result:

First:
	- First
	- Second @today @done(2016-04-06)
Second:
	- First @done(2016-04-06)

In result copyed all projects and tasksdocument without search filters

Not seeing that here. Something about the whitespace characters around your - First line ?

(I’m not seeing the hyphenated first line after the First: project)

Hi, this is actually how it’s intended to work right now, though that behavior might be changed the the future. Please check out (and send in your ideas for improvement) this related post:

1 Like

I think they are talking about when you copy/paste, not the initial search results display.

Ah … understood : - )

For a second mode of copying (only the visible lines in the selection) perhaps a script attached to ⌘⌥C ?

Possibly something like this:

(To test in Script Editor, set the language selector to JavaScript)

// COPY ONLY THE SELECTED LINES WHICH ARE VISIBLE IN TASKPAPER 3
// (not copying lines which are folded or filtered away)

(function () {
    'use strict';

    function TaskPaperContext(editor) {

        // Only the visible component of the selection

        return editor
            .selection
            .selectedItems
            .filter(function (item) {
                return editor.isDisplayed(item);
            })
            .map(function (item) {
                return Array(item.depth)
                    .join('\t') + item.bodyString;
            })
            .join('\n');

    }

    var ds = Application("com.hogbaysoftware.TaskPaper3")
        .documents,
        d = ds.length ? ds[0] : undefined;

    if (d) {

        // COPY THE VISIBLE LINES WHICH ARE SELECTED
        var a = Application.currentApplication(),
            sa = (a.includeStandardAdditions = true, a),
            strLines = d.evaluate({
                script: TaskPaperContext.toString()
            });

        sa.setTheClipboardTo(
            strLines
        );

        return strLines;
    }

})();

@complexpoint thank. This script worked well for me.

@jessegrosjean ok. Thank you. I’m Agree with hybrid options with deleting in filtered view. However, it is strange and not intuitive for me when copying filtered data, because i thinked about filtered data and i needed only this data in this context.